/**
 * Copyright 2008 Adam Ruggles.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package kiff.dao.hibernate;

import kiff.dao.CoreDAO;
import kiff.dao.ForumAclDAO;
import kiff.dao.ForumAclEntryDAO;
import kiff.dao.ForumDAO;
import kiff.dao.GlobalAclDAO;
import kiff.dao.GlobalAclEntryDAO;
import kiff.dao.PostDAO;
import kiff.dao.RoleDAO;
import kiff.dao.SettingDAO;
import kiff.dao.TopicDAO;
import kiff.dao.UserDAO;
import kiff.entity.Forum;
import kiff.entity.ForumAcl;
import kiff.entity.ForumAclEntry;
import kiff.entity.GlobalAcl;
import kiff.entity.GlobalAclEntry;
import kiff.entity.Post;
import kiff.entity.Role;
import kiff.entity.Setting;
import kiff.entity.Topic;
import kiff.entity.User;

import com.google.inject.AbstractModule;
import com.google.inject.Scopes;
import com.google.inject.TypeLiteral;
/**
 * Hibernate DAO Module, binds Guice to the implementation of the DAO layer in this package.
 * @author Adam
 * @version $Id: HibernateDAOModule.java 62 2008-10-31 04:51:50Z a.ruggles $
 * 
 * Created on Oct 2, 2008 at 11:04:11 PM 
 */
public class HibernateDAOModule extends AbstractModule {
	/**
	 * {@inheritDoc}
	 * @see com.google.inject.AbstractModule#configure()
	 */
	@Override
	protected void configure() {
		// Bind to Service Layer DAO.
		bind(new TypeLiteral<CoreDAO<Forum>>() { }).to(ForumHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<ForumAcl>>() { }).to(ForumAclHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<ForumAclEntry>>() { }).to(ForumAclEntryHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<GlobalAcl>>() { }).to(GlobalAclHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<GlobalAclEntry>>() { }).to(GlobalAclEntryHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<Post>>() { }).to(PostHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<Role>>() { }).to(RoleHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<Setting>>() { }).to(SettingHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<Topic>>() { }).to(TopicHibernateDAO.class).in(Scopes.SINGLETON);
		bind(new TypeLiteral<CoreDAO<User>>() { }).to(UserHibernateDAO.class).in(Scopes.SINGLETON);
		// Bind to Interfaces.
		bind(ForumDAO.class).to(ForumHibernateDAO.class).in(Scopes.SINGLETON);
		bind(ForumAclDAO.class).to(ForumAclHibernateDAO.class).in(Scopes.SINGLETON);
		bind(ForumAclEntryDAO.class).to(ForumAclEntryHibernateDAO.class).in(Scopes.SINGLETON);
		bind(GlobalAclDAO.class).to(GlobalAclHibernateDAO.class).in(Scopes.SINGLETON);
		bind(GlobalAclEntryDAO.class).to(GlobalAclEntryHibernateDAO.class).in(Scopes.SINGLETON);
		bind(PostDAO.class).to(PostHibernateDAO.class).in(Scopes.SINGLETON);
		bind(RoleDAO.class).to(RoleHibernateDAO.class).in(Scopes.SINGLETON);
		bind(SettingDAO.class).to(SettingHibernateDAO.class).in(Scopes.SINGLETON);
		bind(TopicDAO.class).to(TopicHibernateDAO.class).in(Scopes.SINGLETON);
		bind(UserDAO.class).to(UserHibernateDAO.class).in(Scopes.SINGLETON);
	}

}
